package cn.polymhomework03;
//工厂类


public class CalculatorFactory {
    public static Calculator creatOperation(String oper){
        Calculator operation=null;
        switch (oper) {
            case "+":
                operation=new Add();
                break;
            case "-":
                operation=new Sub();
                break;
            case "*":
                operation=new Mul();
                break;
            case "/":
                operation=new Div();
                break;
        }
        return operation;
    }
}

